package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.entity.vo.CustomerCardVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 客户银行卡视图Mapper接口
 */
@Mapper
public interface CustomerCardMapper extends BaseMapper<CustomerCardVO> {
    
    /**
     * 根据卡号查询银行卡信息
     * 
     * @param cardId 卡号
     * @return 银行卡信息
     */
    @Select("SELECT u.customer_id, u.customer_name, u.pid, u.telephone, c.card_id, c.balance, c.is_report_loss, d.saving_name " +
           "FROM user_info u " +
           "JOIN card_info c ON u.customer_id = c.customer_id " +
           "JOIN deposit d ON c.saving_id = d.saving_id " +
           "WHERE c.card_id = #{cardId}")
    CustomerCardVO findByCardId(@Param("cardId") String cardId);
} 